#lang racket

(define (make-point x y) (cons x y))

(define (x-point point) (car point))

(define (y-point point) (cdr point))

(define (print-point p)
  (newline)
  (display "(")
  (display (x-point p))
  (display ", ")
  (display (y-point p))
  (display ")"))

;(define (make-reck top-left width height) (cons top-left (cons width height)))

;(define (top-left-point-reck reck) (car reck))

;(define (width-reck reck) (car (cdr reck)))

;(define (height-reck reck) (cdr (cdr reck)))

;(define reck (make-reck (make-point 10 20) 30 40))

;(top-left-point-reck reck)

;(width-reck reck)

;(height-reck reck)

(define (make-reck top-left bottom-right) (cons top-left bottom-right))

(define (top-left-reck reck) (car reck))

(define (bottom-right-reck reck) (cdr reck))

(define (width-reck reck) (abs (- (car (car reck)) (car (cdr reck)))))

(define (height-reck reck) (abs (- (cdr (car reck)) (cdr (cdr reck)))))

(define reck (make-reck (make-point 10 20) (make-point 40 60)))

(define (perimeter-reck reck) (* (+ (width-reck reck) (height-reck reck)) 2))

(define (area-reck reck) (* (width-reck reck) (height-reck reck)))

(perimeter-reck reck)

(area-reck reck)

